/**
 * 
 */
package com.groovy;

import groovy.lang.GroovyClassLoader;
import groovy.lang.Script;

/**
 * @author LionBule
 * 2011-4-28 ����05:18:26
 */
public class TestScript {

	/**
	 * @param args
	 * @throws IllegalAccessException 
	 * @throws InstantiationException 
	 */
	@SuppressWarnings("unchecked")
	public static void main(String[] args) throws InstantiationException, IllegalAccessException {
		String scriptText = "int i=2; ++i; System.out.println(i);";
		
		GroovyClassLoader classLoader = new GroovyClassLoader();
		Class<Script> scriptClass = classLoader.parseClass(scriptText);
		Script script1 = scriptClass.newInstance();
		script1.run();
		
		Script script2 = scriptClass.newInstance();
		script2.run();
		//System.out.println((String)s);
	}

}
